package com.example;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class MyDaoGenerator {
    public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, "com.cdq.che.entity");
        schema.setDefaultJavaPackageDao("com.cdq.che.dao");
        addCheInfo(schema);
        addCheOnline(schema);
        addMap(schema);
        new DaoGenerator().generateAll(schema, "D:\\MyDocument\\MyWorkSpace\\AndroidStudio\\Android_workspace\\SmartMobileRobot\\app\\src\\main\\java-gen");
    }

    private static void addCheInfo(Schema schema) {
        Entity che_info = schema.addEntity("Che_info");
        //主键 int类型
        che_info.addIdProperty();
        //name
        che_info.addStringProperty("name").notNull();
        //type
        che_info.addStringProperty("type");
        //info
        che_info.addStringProperty("info");
        //state
        che_info.addIntProperty("state");
        //update_time
        che_info.addDateProperty("update_time");
    }

    private static void addCheOnline(Schema schema) {
        Entity che_online = schema.addEntity("Che_online");
        // 主键 int类型
        che_online.addIdProperty();
        che_online.addFloatProperty("distance");
        che_online.addFloatProperty("direction");
        che_online.addFloatProperty("speed");
        che_online.addIntProperty("x");
        che_online.addIntProperty("y");
        che_online.addStringProperty("ip_address");
        che_online.addStringProperty("port");
        che_online.addDateProperty("update_time");
    }

    private static void addMap(Schema schema) {
        Entity map = schema.addEntity("CheMap");
        // 主键 int类型
        map.addIdProperty();
        map.addStringProperty("content");
        map.addIntProperty("width");
        map.addIntProperty("height");
        map.addStringProperty("block_width");
        map.addStringProperty("best_path");
        map.addDateProperty("update_time");
    }

}
